<?php
    class  VES_VendorsWarehouse_Model_Address extends Mage_Core_Model_Abstract {
        const STATUS_ENABLED = 1;
        const STATUS_DISABLED = 0;
        
            protected  function  _construct(){       
                    $this->_init('vendorswarehouse/address');
                    
              }
           
            public  function  getAvailableStatuses(){
                $statuses = new Varien_Object(array(
                    self::STATUS_ENABLED => Mage::helper('vendorswarehouse')->__('启用'),
                    self::STATUS_DISABLED => Mage::helper('vendorswarehouse')->__('禁用'),
                ));
                return $statuses->getData();
            }
            public  function getAvailableStatusOption(){
                return array(
                    array(
                        'label' => Mage::helper('vendorswarehouse')->__('启用'),
                        'value' =>   self::STATUS_ENABLED
                    ),
                    array(
                        'label' => Mage::helper('vendorswarehouse')->__('禁用'),
                        'value' =>  self::STATUS_DISABLED
                    ),
        
                );
            }
            public  function getVendorId(){
                
                      return   Mage::getSingleton('vendors/session')->getId();
            }
            public function getWarehouseCodeOption(){
                $resData = array();
                $vendor_id = $this->getVendorId();
                $collection = $this->getCollection()->addFieldToFilter("vendor_id",array("eq"=>$vendor_id));
                $warehouse_list = $collection->getData();
                foreach ($warehouse_list as $k => $v){
                    $resData[$k]['label'] = $v['sender_name'];
                    $resData[$k]['value'] = $v['sender_zip_code'];
                }
                return $resData;
            }
    }